package org.pinda.gui.loading;

import org.pinda.PindaConfig;
import org.pinda.PindaServerConfig;
import org.pinda.gui.Gui;
import org.pinda.gui.MainMenuGui;

/**
 * Test class to show-off the loading technique
 * @author Johnnei
 *
 */
public class LoadGame implements ILoadingThread {

	private byte progress;
	private Gui parent;
	private String statusMessage;
	
	public LoadGame(Gui parent) {
		this.parent = parent;
		statusMessage = "Loading Config";
	}
	
	@Override
	public void onTick(int loadingPhase) {
		if(loadingPhase == 0) {
			PindaConfig.getInstance();
			progress = 50;
		}
		else if(loadingPhase == 1) {
			PindaServerConfig.getInstance();
			progress = 100;
		}
	}

	@Override
	public byte getProgress() {
		return progress;
	}

	@Override
	public Gui getGui() {
		return new MainMenuGui(parent);
	}

	@Override
	public String getStatus() {
		return statusMessage;
	}

}
